using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._SpatialAnalystTools._SegmentationandClassification
{
    /// <summary>
    /// <para>Train Random Trees Classifier</para>
    /// <para>Generates an Esri classifier definition file (.ecd) using the Random Trees classification method.</para>
    /// <para>使用随机树分类方法生成 Esri 分类器定义文件 （.ecd）。</para>
    /// </summary>    
    [DisplayName("Train Random Trees Classifier")]
    public class TrainRandomTreesClassifier : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public TrainRandomTreesClassifier()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_raster">
        /// <para>Input Raster</para>
        /// <para><xdoc>
        ///   <para>The raster dataset to classify.</para>
        ///   <para>You can use any Esri-supported raster dataset. One option is a 3-band, 8-bit segmented raster dataset in which all the pixels in the same segment have the same color. The input can also be a single band, 8-bit, grayscale segmented raster.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>要分类的栅格数据集。</para>
        ///   <para>您可以使用任何 Esri 支持的栅格数据集。一种选项是 3 波段、8 位分段栅格数据集，其中同一线段中的所有像素都具有相同的颜色。输入也可以是单波段、8 位、灰度分割栅格。</para>
        /// </xdoc></para>
        /// </param>
        /// <param name="_in_training_features">
        /// <para>Input Training Sample File</para>
        /// <para><xdoc>
        ///   <para>The training sample file or layer that delineates the training sites.</para>
        ///   <para>These can be either shapefiles or feature classes that contain the training samples. The following field names are required in the training sample file:
        ///   <bulletList>
        ///     <bullet_item>classname—A text field indicating the name of the class category  </bullet_item><para/>
        ///     <bullet_item>classvalue—A long integer field containing the integer value for each class category  </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>用于描述训练站点的训练示例文件或图层。</para>
        /// <para>这些可以是包含训练样本的 shapefile 或要素类。训练示例文件中需要以下字段名称：
        ///   <bulletList>
        ///     <bullet_item>classname - 指示类类别名称的文本字段</bullet_item><para/>
        ///     <bullet_item>classvalue - 包含每个类类别的整数值的长整数字段</bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// </param>
        /// <param name="_out_classifier_definition">
        /// <para>Output Classifier Definition File</para>
        /// <para>A JSON file that contains attribute information, statistics, or other information for the classifier. An .ecd file is created.</para>
        /// <para>一个 JSON 文件，其中包含分类器的属性信息、统计信息或其他信息。将创建一个 .ecd 文件。</para>
        /// </param>
        public TrainRandomTreesClassifier(object _in_raster, object _in_training_features, object _out_classifier_definition)
        {
            this._in_raster = _in_raster;
            this._in_training_features = _in_training_features;
            this._out_classifier_definition = _out_classifier_definition;
        }
        public override string ToolboxName => "Spatial Analyst Tools";

        public override string ToolName => "Train Random Trees Classifier";

        public override string CallName => "sa.TrainRandomTreesClassifier";

        public override List<string> AcceptEnvironments => ["extent", "geographicTransformations", "outputCoordinateSystem", "scratchWorkspace", "snapRaster", "workspace"];

        public override object[] ParameterInfo => [_in_raster, _in_training_features, _out_classifier_definition, _in_additional_raster, _max_num_trees, _max_tree_depth, _max_samples_per_class, _used_attributes, _dimension_value_field];

        /// <summary>
        /// <para>Input Raster</para>
        /// <para><xdoc>
        ///   <para>The raster dataset to classify.</para>
        ///   <para>You can use any Esri-supported raster dataset. One option is a 3-band, 8-bit segmented raster dataset in which all the pixels in the same segment have the same color. The input can also be a single band, 8-bit, grayscale segmented raster.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>要分类的栅格数据集。</para>
        ///   <para>您可以使用任何 Esri 支持的栅格数据集。一种选项是 3 波段、8 位分段栅格数据集，其中同一线段中的所有像素都具有相同的颜色。输入也可以是单波段、8 位、灰度分割栅格。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Raster")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_raster { get; set; }


        /// <summary>
        /// <para>Input Training Sample File</para>
        /// <para><xdoc>
        ///   <para>The training sample file or layer that delineates the training sites.</para>
        ///   <para>These can be either shapefiles or feature classes that contain the training samples. The following field names are required in the training sample file:
        ///   <bulletList>
        ///     <bullet_item>classname—A text field indicating the name of the class category  </bullet_item><para/>
        ///     <bullet_item>classvalue—A long integer field containing the integer value for each class category  </bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>用于描述训练站点的训练示例文件或图层。</para>
        /// <para>这些可以是包含训练样本的 shapefile 或要素类。训练示例文件中需要以下字段名称：
        ///   <bulletList>
        ///     <bullet_item>classname - 指示类类别名称的文本字段</bullet_item><para/>
        ///     <bullet_item>classvalue - 包含每个类类别的整数值的长整数字段</bullet_item><para/>
        ///   </bulletList>
        ///   </para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Training Sample File")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_training_features { get; set; }


        /// <summary>
        /// <para>Output Classifier Definition File</para>
        /// <para>A JSON file that contains attribute information, statistics, or other information for the classifier. An .ecd file is created.</para>
        /// <para>一个 JSON 文件，其中包含分类器的属性信息、统计信息或其他信息。将创建一个 .ecd 文件。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Classifier Definition File")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _out_classifier_definition { get; set; }


        /// <summary>
        /// <para>Additional Input Raster</para>
        /// <para>Ancillary raster datasets, such as a multispectral image or a DEM, will be incorporated to generate attributes and other required information for classification. This parameter is optional.</para>
        /// <para>将合并辅助栅格数据集（例如多光谱影像或 DEM）以生成属性和其他分类所需信息。此参数是可选的。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Additional Input Raster")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _in_additional_raster { get; set; } = null;


        /// <summary>
        /// <para>Max Number of Trees</para>
        /// <para>The maximum number of trees in the forest. Increasing the number of trees will lead to higher accuracy rates, although this improvement will level off eventually. The number of trees increases the processing time linearly.</para>
        /// <para>森林中的最大树数。增加树木的数量将导致更高的准确率，尽管这种改进最终会趋于平稳。树的数量线性增加处理时间。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Max Number of Trees")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long _max_num_trees { get; set; } = 50;


        /// <summary>
        /// <para>Max Tree Depth</para>
        /// <para>The maximum depth of each tree in the forest. Depth is another way of saying the number of rules each tree is allowed to create to come to a decision. Trees will not grow any deeper than this setting.</para>
        /// <para>森林中每棵树的最大深度。深度是另一种说法，表示每棵树被允许创建的规则数量以做出决定。树木不会长得比这个设置更深。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Max Tree Depth")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long _max_tree_depth { get; set; } = 30;


        /// <summary>
        /// <para>Max Number of Samples Per Class</para>
        /// <para><xdoc>
        ///   <para>The maximum number of samples that will be used to define each class.</para>
        ///   <para>The default value of 1000 is recommended when the inputs are nonsegmented rasters. A value that is less than or equal to 0 means that the system will use all the samples from the training sites to train the classifier.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将用于定义每个类的最大样本数。</para>
        ///   <para>当输入为非分割栅格时，建议使用默认值 1000。小于或等于 0 的值表示系统将使用训练站点中的所有样本来训练分类器。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Max Number of Samples Per Class")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long _max_samples_per_class { get; set; } = 1000;


        /// <summary>
        /// <para>Segment Attributes</para>
        /// <para><xdoc>
        ///   <para>Specifies the attributes that will be included in the attribute table associated with the output raster.</para>
        ///   <bulletList>
        ///     <bullet_item>Converged color—The RGB color values will be derived from the input raster on a per-segment basis.</bullet_item><para/>
        ///     <bullet_item>Mean digital number—The average digital number (DN) will be derived from the optional pixel image on a per-segment basis.</bullet_item><para/>
        ///     <bullet_item>Standard deviation—The standard deviation will be derived from the optional pixel image on a per-segment basis.</bullet_item><para/>
        ///     <bullet_item>Count of pixels—The number of pixels composing the segment, on a per-segment basis.</bullet_item><para/>
        ///     <bullet_item>Compactness—The degree to which a segment is compact or circular, on a per-segment basis. The values range from 0 to 1, in which 1 is a circle.</bullet_item><para/>
        ///     <bullet_item>Rectangularity—The degree to which the segment is rectangular, on a per-segment basis. The values range from 0 to 1, in which 1 is a rectangle.</bullet_item><para/>
        ///   </bulletList>
        ///   <para>This parameter is only active if the Segmented key property is set to true on the input raster. If the only input to the tool is a segmented image, the default attributes are Average chromaticity color, Count of pixels, Compactness, and Rectangularity. If an Additional Input Raster value is included as an input with a segmented image, Mean digital number and Standard deviation are also available attributes.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定将包含在与输出栅格关联的属性表中的属性。</para>
        ///   <bulletList>
        ///     <bullet_item>收敛颜色 - RGB 颜色值将基于每个区段从输入栅格派生。</bullet_item><para/>
        ///     <bullet_item>平均数字数字 - 平均数字数字 （DN） 将基于每个段从可选像素图像派生。</bullet_item><para/>
        ///     <bullet_item>标准差—标准差将基于每个段从可选像素图像派生。</bullet_item><para/>
        ///     <bullet_item>像素计数 - 组成区段的像素数（按每个区段计算）。</bullet_item><para/>
        ///     <bullet_item>紧凑度 - 线段的紧凑度或圆形程度（基于每个线段）。值范围从 0 到 1，其中 1 是一个圆。</bullet_item><para/>
        ///     <bullet_item>矩形 - 线段的矩形程度（按线段计算）。值的范围为 0 到 1，其中 1 是矩形。</bullet_item><para/>
        ///   </bulletList>
        ///   <para>仅当输入栅格上的分割键属性设置为 true 时，此参数才处于活动状态。如果工具的唯一输入是分割图像，则默认属性为平均色度颜色、像素计数、紧凑度和矩形度。如果附加输入栅格值作为分割影像的输入包含在内，则平均数字数和标准差也是可用属性。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Segment Attributes")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public List<object> _used_attributes { get; set; } = null;


        /// <summary>
        /// <para>Dimension Value Field</para>
        /// <para><xdoc>
        ///   <para>Contains dimension values in the input training sample feature class.</para>
        ///   <para>This parameter is required to classify a time series of raster data using the change analysis raster output from the Analyze Changes Using CCDC tool in the Image Analyst toolbox.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>包含输入训练示例要素类中的维度值。</para>
        ///   <para>使用 Image Analyst 工具箱中使用 CCDC 分析变化工具的变化分析栅格输出对栅格数据的时间序列进行分类时，需要此参数。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Dimension Value Field")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _dimension_value_field { get; set; } = null;


        public TrainRandomTreesClassifier SetEnv(object extent = null, object geographicTransformations = null, object outputCoordinateSystem = null, object scratchWorkspace = null, object snapRaster = null, object workspace = null)
        {
            base.SetEnv(extent: extent, geographicTransformations: geographicTransformations, outputCoordinateSystem: outputCoordinateSystem, scratchWorkspace: scratchWorkspace, snapRaster: snapRaster, workspace: workspace);
            return this;
        }

    }

}